﻿using System;
using System.Windows.Media.Media3D;
using HelixToolkit.Wpf;

namespace GameBoard
{
    public class MovementCircleVisual : TubeVisual3D, IVisual
    {
        bool _belongsToMoveablePicture = false;
        public bool BelongsToMoveablePicture
        {
            get { return _belongsToMoveablePicture; }
        }
        public void PopulateVisualData(BaseVisualData theData)
        {
            _belongsToMoveablePicture = theData.BelongsToMoveablePicture;
            FactoryID = theData.FactoryID;

            var circData = theData as MovementCircleVisualData;
            var allPoints = Helper3DCalcs.CirclePoints(circData.Speed*
                                                       circData.CurCircleSize, circData.Location, 4);
            for(int curIndex = 0;curIndex<allPoints.Count;curIndex++)
            {
                var cur = allPoints[curIndex];
                cur.Z += 10;
            }
            Path = new Point3DCollection(allPoints);
            Material = MaterialMaker.MaterialFromColor(circData.MaterialColor);
            ThetaDiv = 18;
        }

        public Guid FactoryID { get; set; }

        public ModelVisual3D VisualElement
        {
            get { return this; }
        }
    }
}